package com.sbs.gaoxinqutoilet.adapter;

import android.view.View;

import androidx.annotation.LayoutRes;
import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.sbs.gaoxinqutoilet.R;
import com.sbs.gaoxinqutoilet.entity.AcceptItemEntity;
import com.zhy.autolayout.utils.AutoUtils;

import java.util.List;

/**
 * Created by 聪明一只哈 on 2018/5/30.
 * Time: 2018/5/30  17:37AcceptItemEntity acceptItemEntity
 */

public class ToiletAcceptRvAdapter extends BaseQuickAdapter<AcceptItemEntity.DataBean, ToiletAcceptRvAdapter.BuyApplyViewHolder> {


    public ToiletAcceptRvAdapter(@LayoutRes int layoutResId, @Nullable List<AcceptItemEntity.DataBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BuyApplyViewHolder helper, AcceptItemEntity.DataBean item) {


        helper.setText(R.id.item_accept_tv_name,item.getHuming());
        helper.setText(R.id.item_tf_buildaccept,item.getGaizao_type_n());
        //helper.setText(R.id.item_tf_statedesc,item.getYanshou_result_n());
        helper.setText(R.id.item_tv_address_accept,item.getArea_name());


        switch(item.getYanshou_result_n()){
            case "":
            case "未验收":
                helper.getView(R.id.item_tf_image).setBackgroundResource(R.drawable.accept_uc);
                helper.setText(R.id.item_tf_statedesc,"未验收");
                break;
            case "合格":
                helper.getView(R.id.item_tf_image).setBackgroundResource(R.drawable.accept_c);
                helper.setText(R.id.item_tf_statedesc,"合    格");
                break;
            case "不合格":
                helper.getView(R.id.item_tf_image).setBackgroundResource(R.drawable.accept_fail);
                helper.setText(R.id.item_tf_statedesc,"不合格");
                break;

            default:

                break;
        }


//----------adapter条目点击-----------------------------------
//        helper.addOnClickListener(R.id.buy_apply_ll).addOnClickListener(R.id.buy_state_delete)
//                .addOnClickListener(R.id.buy_state_upload);

    }

    public class BuyApplyViewHolder extends BaseViewHolder {

        public BuyApplyViewHolder(View view) {
            super(view);
            AutoUtils.auto(view);
        }
    }
}
